package com.ssms.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ssms.domain.Student;
import com.ssms.mapper.StudentMapper;
import com.ssms.service.StudentService;
import com.ssms.utils.JwtUtils;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> implements StudentService {
    @Override
    public String createToken(Student student) {
        Map tokenMap = new HashMap();
        tokenMap.put("id",student.getStudentId());
        tokenMap.put("name",student.getStudentName());
        tokenMap.put("class",student.getStudentClass());
        tokenMap.put("number",student.getStudentNum());
        tokenMap.put("role",student.getRole());
        tokenMap.put("counsellor_id",student.getCounsellorId());
        tokenMap.put("major",student.getMajor());
        tokenMap.put("gender",student.getGender());
        tokenMap.put("borndate",student.getBorndate());
        tokenMap.put("telephone",student.getTelephone());
        tokenMap.put("academy",student.getAcademy());
        String token = JwtUtils.getToken(tokenMap);
        return token;
    }
}
